package com.microservices.yucloud.appweb.config;

import com.microservices.yucloud.appweb.enums.BizOrderEventsEnum;
import com.microservices.yucloud.appweb.enums.BizOrderStatusEnum;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.statemachine.data.redis.RedisStateMachineContextRepository;

import javax.annotation.Resource;

/**
 * @author zy
 * @date 2019-09-03 15:07
 **/
@Configuration
public class BizOrderRedisStateMachineRepositoryConfig {

    @Resource
    private RedisConnectionFactory redisConnectionFactory;

    @Bean
    public RedisStateMachineContextRepository<BizOrderStatusEnum, BizOrderEventsEnum> redisStateMachineContextRepository() {
        return new RedisStateMachineContextRepository<>(redisConnectionFactory);
    }
}
